package com.weaver.seconddev.api.tl.price_approval_api;
import okhttp3.*;

import java.util.concurrent.TimeUnit;

/**
 * @author chenkang.xu@weaver.cn
 * @create 2025-08-09 上午10:46
 * @Description
 */

public class OkHttpUtils {
    private static volatile OkHttpClient okHttpClient = null;

    /**
     * 初始化okHttpClient，并且允许https访问
     * 公共交易通用
     * 读超时时间设置为：60秒
     */
    public static OkHttpClient builderOkhttpClient() {
        if (okHttpClient == null) {
            synchronized (OkHttpUtils.class) {
                if (okHttpClient == null) {
                    okHttpClient = new OkHttpClient.Builder().connectTimeout(5, TimeUnit.SECONDS).readTimeout(60, TimeUnit.SECONDS).retryOnConnectionFailure(true).build();
                }
            }
        }
        return okHttpClient;
    }

}
